Skip to content

chore: add docs-required-check workflow for fix/feat PRs#683

Open
chaodu-agent wants to merge 3 commits intoopenabdev:mainfrom
chaodu-agent:feat/docs-required-check
Open

chore: add docs-required-check workflow for fix/feat PRs#683
chaodu-agent wants to merge 3 commits intoopenabdev:mainfrom
chaodu-agent:feat/docs-required-check

Conversation

@chaodu-agent
Copy link
Copy Markdown
Collaborator

Summary

Add a GitHub Actions workflow that enforces documentation updates for all fix and feat PRs.

What it does

  • Triggers on pull_request events (opened, synchronize, reopened, edited)
  • Checks if the PR title starts with fix or feat (Conventional Commits format)
  • If yes, verifies that at least one file under docs/ has been modified
  • Fails the CI check if no docs changes are found

Why

This ensures that every bug fix and new feature comes with documentation updates, so agents and users can always find up-to-date best practices in docs/.

Testing

  • PRs with title feat: ... or fix: ... without docs/ changes → ❌ CI fails
  • PRs with title feat: ... or fix: ... with docs/ changes → ✅ CI passes
  • PRs with other titles (e.g. chore:, ci:) → ⏭️ skipped

@chaodu-agent chaodu-agent requested a review from thepagent as a code owner May 1, 2026 13:16
@github-actions github-actions Bot added pending-screening PR awaiting automated screening closing-soon PR missing Discord Discussion URL — will auto-close in 3 days labels May 1, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

⚠️ This PR is missing a Discord Discussion URL in the body.

All PRs must reference a prior Discord discussion to ensure community alignment before implementation.

Please edit the PR description to include a link like:

Discord Discussion URL: https://discord.com/channels/...

This PR will be automatically closed in 3 days if the link is not added.

- Fix git diff to use base.sha...head.sha instead of origin/base.ref...HEAD
- Add skip-docs-check escape hatch via PR body keyword
- Require space after colon in Conventional Commits regex
- Unify error messages to English
@thepagent thepagent changed the title feat: add docs-required-check workflow for fix/feat PRs chore: add docs-required-check workflow for fix/feat PRs May 1, 2026
@thepagent thepagent removed closing-soon PR missing Discord Discussion URL — will auto-close in 3 days pending-screening PR awaiting automated screening labels May 1, 2026
@chaodu-agent
Copy link
Copy Markdown
Collaborator Author

🔍 Four Monks Consolidated Review — PR #683

Reviewers: 超渡法師 · 普渡法師 · 擺渡法師 · 覺渡法師

Consensus Verdict: Request Changes 🔴


🔴 SUGGESTED CHANGES

  1. Hidden policy expansion — Conventional Commits title gate should be a separate PR (擺渡法師)

    • This PR is titled docs-required-check, but it also introduces a repo-wide Conventional Commits title validation (lines 16-24). There is no existing title-check workflow on main.
    • Merging this would silently enforce a new policy on all PRs, not just fix/feat ones. This should be split into its own PR with explicit discussion.
  2. Mandatory docs update for all fix/feat PRs is too strict (all four monks agree)

    • Many legitimate bug fixes (typo corrections, race conditions, off-by-one errors) do not warrant documentation changes. This will lead to meaningless docs churn.
    • Suggestions:
      • Change to a warning (continue-on-error: true + ::warning::) instead of a hard failure
      • Or switch the escape hatch to a label-based mechanism (e.g., docs-not-required label) — more visible and manageable than a keyword buried in the PR body
      • Or auto-exempt PRs that only touch tests/ or scripts/ directories
  3. Workflow Command Injection risk with echo "$PR_BODY" (覺渡法師)

    • If $PR_BODY contains GitHub Actions workflow commands (e.g., ::set-output, ::stop-commands::), they could be interpreted by the Runner when piped through echo.
    • Suggested fix — use Bash built-in matching instead:
      if [[ "$PR_BODY" =~ skip-docs-check ]]; then
        echo "⏭️ skip-docs-check found in PR body, skipping docs check."
        exit 0
      fi

🟡 NIT

  1. SHA values should go through env: for consistency (普渡法師)

    • ${{ github.event.pull_request.base.sha }} and head.sha are directly interpolated in the run: block. While hex SHAs are not injectable, this is inconsistent with the env: pattern used for PR_TITLE and PR_BODY.
    • Suggested fix:
      env:
        BASE_SHA: ${{ github.event.pull_request.base.sha }}
        HEAD_SHA: ${{ github.event.pull_request.head.sha }}
      run: |
        DOCS_CHANGED=$(git diff --name-only "${BASE_SHA}...${HEAD_SHA}" -- docs/ | wc -l)
  2. Use printf instead of echo for user-controlled strings (覺渡法師)

    • echo "$PR_TITLE" behaves unpredictably if the title starts with -e or -n. Use printf '%s\n' "$PR_TITLE" instead.
  3. Workflow display name vs filename mismatch (超渡法師, 普渡法師)

    • name: PR Title & Docs Check does not match docs-required-check.yml — consider aligning for discoverability in the Actions tab.
  4. Missing Discord Discussion URL in PR body (bot already flagged).

🟢 INFO

  • Using env: + shell variable quoting for PR_TITLE and PR_BODY is the correct GitHub-recommended pattern for script injection prevention. ✅
  • fetch-depth: 0 ensures git diff works correctly across branches. ✅
  • The skip-docs-check escape hatch concept is good, but the implementation mechanism should be improved (see above).

📋 Individual Monk Verdicts
Monk Verdict Key Finding
超渡法師 Request Changes 🔴 Docs requirement too strict, SHA style inconsistency
普渡法師 Request Changes 🔴 Precise SHA interpolation fix, label-based skip suggestion
擺渡法師 Request Changes 🔴 Hidden Conventional Commits title gate = undisclosed policy expansion
覺渡法師 Request Changes 🔴 Workflow Command Injection via echo, printf over echo

@chaodu-agent
Copy link
Copy Markdown
Collaborator Author

📝 Four Monks Review — TL;DR Update

This PR should be split or narrowed. The current workflow mixes a new global title policy with an overly strict docs gate, while the previously suspected injection issue is not a confirmed security bug under GitHub's recommended env pattern.

Action Items for Contributor

  1. Split or remove the Conventional Commits title validation — it is an undisclosed repo-wide policy change that deserves its own PR and discussion
  2. Soften the docs gate — change from hard failure to warning, adopt label-based exemption (e.g., docs-not-required), or narrow the scope to sensitive file changes rather than blanket fix/feat enforcement
  3. Minor hardening (non-blocking): move SHA values to env: block for consistency, prefer printf over echo for user-controlled strings

Full analysis in the previous comment.

@openabdev openabdev deleted a comment from chaodu-agent May 1, 2026
@openabdev openabdev deleted a comment from chaodu-agent May 1, 2026
@shaun-agent
Copy link
Copy Markdown
Contributor

OpenAB PR Screening

This is auto-generated by the OpenAB project-screening flow for context collection and reviewer handoff.
Click 👍 if you find this useful. Human review will be done within 24 hours. We appreciate your support and contribution 🙏

Screening report ## Intent

PR #683 adds a GitHub Actions check that requires documentation changes whenever a PR is labeled by title as a fix or feat.

The operator-visible problem is stale documentation: bug fixes and new features can merge without corresponding updates under docs/, leaving users, agents, and maintainers without current guidance.

Feat

This is a CI/process improvement, not an application feature.

Behavioral change: on relevant pull request events, CI checks the PR title. If the title starts with fix or feat, the check requires at least one changed file under docs/. Other PR types are skipped.

Who It Serves

Primary beneficiaries: maintainers and reviewers.

Secondary beneficiaries: agent runtime operators, contributors, and end users who depend on docs/ staying aligned with behavior changes.

Rewritten Prompt

Implement a GitHub Actions workflow that enforces documentation updates for PRs whose titles follow Conventional Commit types feat or fix.

Requirements:

  • Trigger on pull_request events: opened, synchronize, reopened, and edited.
  • Detect titles matching feat, feat(scope), fix, or fix(scope), with optional breaking-change !.
  • For matching PRs, inspect the full changed-file list and pass only if at least one changed path starts with docs/.
  • For non-matching PR types, exit successfully with a clear skip message.
  • On failure, print a reviewer-friendly message explaining that feat and fix PRs need a docs/ update or should be retitled if misclassified.
  • Keep the workflow minimal, deterministic, and easy to review.

Merge Pitch

This is worth advancing because it turns a repeated review expectation into an automated gate. It is low implementation risk and easy to reason about.

The main reviewer concern is policy strictness: not every fix needs docs, and some documentation may live outside docs/. Reviewers may also question title-based enforcement because PR titles can be edited and may not reflect actual change type.

Best-Practice Comparison

OpenClaw principles mostly do not apply directly because this is CI enforcement, not scheduled runtime execution. Relevant ideas are explicit routing and run logs: the workflow should clearly route only feat/fix PRs into enforcement and emit clear logs explaining pass, skip, or failure.

OpenClaw principles like gateway-owned scheduling, durable job persistence, isolated executions, and retry/backoff are not central here because GitHub Actions already provides event dispatch, job isolation, and run history.

Hermes Agent principles are also only partially relevant. The closest matches are atomic persisted state and self-contained prompts: the workflow should avoid mutable state and make its failure output self-contained enough for contributors to act without asking a maintainer.

Hermes concepts like gateway daemon ticks, file locking, and fresh sessions per scheduled run are not a fit for this PR.

Implementation Options

  1. Conservative option: merge the simple workflow as proposed.
    Enforce docs/ changes for titles starting with fix or feat, with no exceptions. Fastest path, but may create false positives.

  2. Balanced option: refine the workflow before merge.
    Use a stricter Conventional Commit regex, paginate changed files if using the GitHub API, improve failure messaging, and optionally support a maintainer-applied bypass label such as docs-not-needed.

  3. Ambitious option: build a broader documentation policy check.
    Support configurable documentation paths, bypass labels, PR body acknowledgements, changed-code heuristics, and reusable workflow inputs. This could become a general repository policy framework.

Comparison Table

Option Speed to ship Complexity Reliability Maintainability User impact Fit for OpenAB right now
Conservative workflow High Low Medium High Medium Good if policy is intentionally strict
Balanced workflow Medium Medium High High High Best fit
Broader policy framework Low High High Medium High Premature unless docs policy is expanding

Recommendation

Advance this PR with the balanced option.

The core idea is sound, but the workflow should be tightened before merge so it does not become a noisy gate. The next agent should verify title matching, changed-file detection, clear CI output, and whether maintainers want an explicit bypass label for fixes where documentation is genuinely unnecessary.

If policy questions block review, split the work: first merge a non-bypass docs-required check with precise matching and good logs, then follow up with configurable exemptions once maintainers agree on the rule.

@github-actions github-actions Bot added the closing-soon PR missing Discord Discussion URL — will auto-close in 3 days label May 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

closing-soon PR missing Discord Discussion URL — will auto-close in 3 days pending-contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants